home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / disp182a.zip / DRVSRC / WDVANILA.ASM < prev   
Assembly Source File  |  1993-04-12  |  12KB  |  379 lines

  1. ;--------------------------------------------------------------------------
  2. ; This is file WD90C31.ASM
  3. ;
  4. ; Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
  5. ; Copyright (C) 1992 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221
  6. ; Copyright (C) 1993 John Horigan, 870 E. El Camino Real #161, Mtn View, CA 94040
  7. ;
  8. ; This file is distributed under the terms listed in the document
  9. ; "copying.dj", available from DJ Delorie at the address above.
  10. ; A copy of "copying.dj" should accompany this file; if not, a copy
  11. ; should be available from where this file was obtained.  This file
  12. ; may not be distributed without a verbatim copy of "copying.dj".
  13. ;
  14. ; This file is distributed WITHOUT ANY WARRANTY; without even the implied
  15. ; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. ;--------------------------------------------------------------------------
  17.  
  18.     .386
  19. include grdriver.inc
  20. cseg    segment byte public use16 'code'
  21.     assume  cs:cseg, ds:cseg, es:cseg, ss:nothing
  22.  
  23.  
  24. ;--------------------------------------------------------------------------
  25. ; DRIVER HEADER
  26. ;  The following entries MUST match the structure and constant
  27. ;  declarations in the file 'grdriver.h' of the GRX graphics library
  28. ;  The mode word should contain the following bitfields:
  29. ;     - the GRD_NEW_DRIVER bit set for any new format driver
  30. ;     - the adapter type field should be specified
  31. ;     - the memory size field should be specified
  32. ;     - the paging mode field should be specified
  33. ;  The mode set routine will OR in the plane bitfield as it will
  34. ;  change when different color number modes are requested.
  35. ;--------------------------------------------------------------------------
  36.  
  37.     dw    offset mode_set_routine
  38.     dw    offset paging_routine
  39. mode_W  dw    GRD_NEW_DRIVER+GRD_VGA+GRD_1024K+GRD_NO_RW
  40. ;
  41. ; The 'def_xx' fields are filled in by go32 from the corresponding
  42. ; fields of the 'GO32' environment variable
  43. ;
  44. def_tw  dw    80        ; text width
  45. def_th  dw    25        ; text height
  46. def_gw  dw    640        ; graphics width
  47. def_gh  dw    480        ; graphics height
  48. def_nc  dw    16        ; graphics colors
  49.     dw    offset driver_init_routine
  50.     dw    offset text_mode_table
  51.     dw    offset graphics_mode_table
  52.  
  53. ;
  54. ; Biggest text and graphics sizes
  55. ;
  56. Max_TW  equ    132
  57. Max_TH  equ    50
  58. Max_GWn equ    800        ; non interlaced!!!
  59. Max_GHn equ    600
  60. Max_GW  equ    1280        ; may be interlaced
  61. Max_GH  equ    1024
  62.  
  63.  
  64. ;--------------------------------------------------------------------------
  65. ; TABLE OF SUPPORTED TEXT MODES
  66. ;    - keep sorted by size
  67. ;    - end with an all 0 entry
  68. ;    - BIOS field = 0xff disables it
  69. ;    - fields:
  70. ;        width,  height, colors, BIOS#+  setup_procedure_index*256
  71. ;--------------------------------------------------------------------------
  72. text_mode_table        label word
  73.     dw    80,    25,    2,    007h +  00000h
  74.     dw    40,    25,    16,    001h +  00000h
  75.     dw    80,    25,    16,    003h +  00000h
  76.     dw    80,    34,    16,    041h +    00000h
  77.     dw    80,    43,    16,    067h +    00000h
  78.     dw    80,    50,    16,    066h +  00000h
  79.     dw    132,    25,    16,    055h +  00000h
  80.     dw    132,    28,    16,    047h +  00000h
  81.     dw    132,    43,    16,    054h +  00000h
  82.     dw    132,    44,    16,    021h +  00000h
  83.     dw    132,    50,    16,    069h +  00100h
  84.     dw    0,    0,    0,    000h +  00000h
  85.  
  86.  
  87. ;--------------------------------------------------------------------------
  88. ; TABLE OF SUPPORTED GRAPHICS MODES
  89. ;    - keep sorted first by colors then by size
  90. ;    - end with an all 0 entry
  91. ;    - BIOS field = 0xff disables it
  92. ;    - fields:
  93. ;        width,  height, colors, BIOS#+  setup_procedure_index*256
  94. ;--------------------------------------------------------------------------
  95. graphics_mode_table    label word
  96.     dw    320,    200,    16,    00dh +  00000h
  97.     dw    640,    200,    16,    00eh +  00000h
  98.     dw    640,    350,    16,    010h +  00000h
  99.     dw    640,    480,    16,    012h +  00000h
  100.     dw    800,    600,    16,    058h +  00000h
  101.     dw    1024,    768,    16,    05dh +  00000h
  102.     dw    1280,    1024,    16,    064h +    00000h
  103.     dw    320,    200,    256,    013h +  00000h
  104.     dw    640,    400,    256,    05eh +  00000h
  105.     dw    640,    480,    256,    05fh +  00000h
  106.     dw    800,    600,    256,    05ch +  00000h
  107.     dw    1024,    768,    256,    060h +  00000h
  108.     dw    0,    0,    0,    000h +  00000h
  109.  
  110.  
  111. ;--------------------------------------------------------------------------
  112. ; TABLE OF SPECIAL SETUP PROCEDURES
  113. ;  You may need such procedures for:
  114. ;     -- reloading fonts on standard EGA or VGA for
  115. ;     higher resolution text modes
  116. ;     -- enable HiColor mode of some Super VGAs
  117. ;     -- Handle the parameter passing conventions of the VESA BIOS
  118. ;     -- put VGA into 256 color plane mode ("MODE X")
  119. ;     -- etc...
  120. ;  There should be one entry in the table for every non-zero
  121. ;  'setup_procedure_index' in the text and graphics mode tables.
  122. ;  The first entry in the table belongs to index 100h, and so on.
  123. ;  The special setup procedure is invoked via a near call.
  124. ;
  125. ;  Entry: DI=address of the mode record from the text or graphics
  126. ;      table to set up.
  127. ;
  128. ;  Exit:  Adapter configured
  129. ;      BX=driver mode word as it should be returned by the mode set
  130. ;         routine. Typically it involves picking up the mode word
  131. ;         from the header and OR-ing in the appropriate bitplane mode
  132. ;         bitfield. (This is not needed for text modes)
  133. ;      AX, CX, DX, SI can be trashed, PRESERVE DI!!!!
  134. ;
  135. ;  NOTE: This runs in real mode, but don't mess with the segment registers.
  136. ;--------------------------------------------------------------------------
  137. special_setup_table    label word
  138.     dw    offset  VGA_50row_mode_set
  139.  
  140. ;
  141. ; Routine to set up VGA 132x50 row mode
  142. ; interface is described above
  143. ;
  144. VGA_50row_mode_set    proc    near
  145.     mov    ax,055h            ; set 132x25 mode
  146.     int    10h
  147.     xor    bx,bx
  148.     mov    ax,1112h        ; load 8x8 font
  149.     int    10h
  150.     ret
  151. VGA_50row_mode_set    endp
  152.  
  153.  
  154. ;--------------------------------------------------------------------------
  155. ; DRIVER INIT ROUTINE
  156. ;  called once after the driver is loaded
  157. ;  may do one or more of the followings:
  158. ;    - check for proper board type
  159. ;    - check amount of RAM on board, and:
  160. ;    -- update word in header to reflect correct amount
  161. ;    -- disable modes in the tables for which there is not enough RAM
  162. ;    - check for special equipment (HiColor DAC, etc...)
  163. ;
  164. ;  Entry: nothing
  165. ;
  166. ;  Exit:  AX=status:
  167. ;       non-zero: OK,
  168. ;       0: something went wrong (e.g. wrong adapter, etc..)
  169. ;      BX,CX,DX may be trashed
  170. ;
  171. ;  NOTE: This runs in real mode, but don't mess with the segment registers.
  172. ;--------------------------------------------------------------------------
  173. driver_init_routine    proc    far
  174.     mov    ax,1
  175.     ret
  176. driver_init_routine    endp
  177.  
  178.  
  179. ;--------------------------------------------------------------------------
  180. ; MODE SET ROUTINE
  181. ;  sets up a text or graphics mode as close as possible to the one
  182. ;  reguested by the user with regard to number of colors and size.
  183. ;
  184. ;  Entry: AX=mode selection
  185. ;     0 = 80x25 text
  186. ;     1 = default text
  187. ;     2 = text CX cols by DX rows
  188. ;     3 = biggest text
  189. ;     4 = 320x200 graphics
  190. ;     5 = default graphics
  191. ;     6 = graphics CX width by DX height
  192. ;     7 = biggest non-interlaced graphics
  193. ;     8 = biggest graphics
  194. ;     9 = graphics BX colors, CX width by DX height
  195. ;
  196. ;  Exit: BX=driver mode flag
  197. ;     CX=width (in pixels or characters)
  198. ;     DX=height
  199. ;
  200. ;  NOTE: This runs in real mode, but don't mess with the segment registers.
  201. ;     YOU SHOULD NOT NEED TO CHANGE THIS ROUTINE AS IT IS PRETTY
  202. ;     MUCH TABLE DRIVEN
  203. ;--------------------------------------------------------------------------
  204. mode_set_routine    proc    far
  205.     push    ds
  206.     push    di
  207.     push    si
  208.     mov    si,cs
  209.     mov    ds,si
  210.     cmp    ax,9
  211.     jbe    DoIt
  212.     jmp    Exit
  213. DoIt:    add    ax,ax
  214.     mov    si,ax
  215.     jmp    WORD PTR mode_set_table[si]
  216. mode_set_table  label    word
  217.     dw    offset mode_0
  218.     dw    offset mode_1
  219.     dw    offset mode_2
  220.     dw    offset mode_3
  221.     dw    offset mode_4
  222.     dw    offset mode_5
  223.     dw    offset mode_6
  224.     dw    offset mode_7
  225.     dw    offset mode_8
  226.     dw    offset mode_9
  227. mode_0: mov    si,offset text_mode_table    ; 80x25 text
  228.     mov    bx,def_nc
  229.     mov    cx,80
  230.     mov    dx,25
  231.     jmp    Lookup
  232. mode_1: mov    si,offset text_mode_table    ; default text
  233.     mov    bx,def_nc
  234.     mov    cx,def_tw
  235.     mov    dx,def_th
  236.     jmp    Lookup
  237. mode_2: mov    si,offset text_mode_table    ; CX*DX text
  238.     mov    bx,def_nc
  239.     jmp    Lookup
  240. mode_3: mov    si,offset text_mode_table    ; biggest text
  241.     mov    bx,def_nc
  242.     mov    cx,Max_TW
  243.     mov    dx,Max_TH
  244.     jmp    Lookup
  245. mode_4: mov    si,offset gra